﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Model;
using BLL;

namespace EstateappraisalApi.Controllers
{
    /// <summary>
    /// 借款人信息
    /// </summary>
    public class Loan_InfoController : ApiController
    {
        Loan_InfoBLL bll = new Loan_InfoBLL();

        // GET api/loan_info
        /// <summary>
        /// 查询对应项目的借款人信息
        /// </summary>
        /// <param name="projectNumber"></param>
        /// <returns></returns>
        public IEnumerable<Loan_Info> Get(string projectNumber)
        {
            return bll.ShowLoan_Info(projectNumber);
        }

        // GET api/loan_info/5
        public string Get(int id)
        {
            return "value";
        }

        
        // POST api/loan_info
        /// <summary>
        /// 添加借款人信息
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public int Post([FromBody]Loan_Info m)
        {
            m.createTime = DateTime.Now;
            m.create_People = "1";
            if (bll.AddLoan_Info(m))
            {
                return 1;
            }
            else
            {
                return 0;
            }



        }

        // PUT api/loan_info/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/loan_info/5
        public void Delete(int id)
        {
        }
    }
}
